<div class="panel-manage">
	<div class="navbar navbar-inverse">
		<div class="navbar-inner text-right">
		    <button id="btn-about-save" class="btn btn-primary">บันทึก</button>
		</div>
	</div>	
	<div class="panel-message"></div>	
	<div class="section" style="margin-top:15px;">
		<form id="frm-about" method="post" action="<?php print base_url() . $cafe_name; ?>/backend/general/about/ajax_save">
			<textarea name="tc" id="tc" class="editor" rows="25" cols="200" style="margin-left:20px;"><?php print $intro_text; ?></textarea>			
		</form>	
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function(){		
		$('#btn-about-save').click(function(){
			$('#frm-about').ajaxSubmit({
								
				success	: function(output){					
					output = JSON.parse(output);
					
					switch (output.result){
						case -2: case -1:{
							
							var html = '<div class="alert alert-error">';
							html += '<button type="button" class="close" data-dismiss="alert">&times;</button>';
							html += output.message + '</div>';
							
							$('.panel-message').html(html);
							setTimeout(function(){ window.location.href = output.redirect_url; },2000)
						}
						break; 
						default:{
							var html;
							if (output.result)
								html = '<div class="alert alert-success">';						
							else 
								html = '<div class="alert alert-error">';					

							html += '<button type="button" class="close" data-dismiss="alert">&times;</button>';
							html += output.message + '</div>';
							$('.panel-message').html(html);

							autoclosealert('.alert', 2000);
						}
						break;
					}
					
				}
			});
		});
		
		$('textarea.editor').tinymce({
			// Location of TinyMCE script
			script_url : '../js/tiny_mce/tiny_mce.js',

			// General options
			theme : "advanced",
			plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
			skin : "bootstrap",

			// Theme options
			theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",			
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : false,

			// Drop lists for link/image/media/template dialogs
			template_external_list_url : "lists/template_list.js",
			external_link_list_url : "lists/link_list.js",
			external_image_list_url : "lists/image_list.js",
			media_external_list_url : "lists/media_list.js"
		});
	});		
</script>